import QtQuick
import QtQuick.Controls
import QtQuick.Window
import QtCharts

Window {
    id: root
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello Python World!")

    required property var dataSource
    
    ChartView {
        id: chartView
        title: "Line Chart"
        anchors.fill: parent
        animationOptions: ChartView.NoAnimation
        theme: ChartView.ChartThemeBlueIcy
        property bool openGL: false
        property bool openGLSupported: true

        Component.onCompleted: {
            root.dataSource.attach_series(chartView.series(0));
        }

        Component.onDestruction: {
            root.dataSource.detach_series(undefined);
        }

        ValueAxis{
            id:axisY1
            min: 0
            max: 10
        }

        ValueAxis{
            id:axisX
            min: 0
            max: 800
        }

        LineSeries{
            id: lineSeries
            name: "Audio Sample"
            axisX: axisX
            axisY: axisY1
            useOpenGL: chartView.openGL
        }
    }
}
